home *** CD-ROM | disk | FTP | other *** search
/ BMUG PD-ROM BV3 / BMUG PD-ROM Version BV3 (CDRM1097900).iso / HyperCard / Utility / Recover / Recover / card_5502.txt < prev    next >
Text File  |  1991-03-29  |  10KB  |  368 lines

  1. -- card: 5502 from stack: in
  2. -- bmap block id: 6476
  3. -- flags: 4000
  4. -- background id: 2723
  5. -- name: recover card
  6. ----- HyperTalk script -----
  7. on openStack
  8.   set scroll of card field "Help" to 0
  9.   pass openStack
  10. end openStack
  11.  
  12. on openCard
  13.   set userLevel to 5
  14.   if number of cards ‚↠1 then
  15.     show button "Prev"
  16.     show button "Next"
  17.   else
  18.     hide button "Prev"
  19.     hide button "Next"
  20.   end if
  21.   hide msg
  22. end openCard
  23.  
  24. -- get file name given path name
  25. function fileFromPath path
  26. get empty
  27. if path is not empty then
  28.   put length(path) into m
  29.   repeat with i = m down to 1
  30.     if char i of path is ":" then exit repeat
  31.     put char i of path before it
  32.   end repeat
  33. end if
  34. return it
  35. end fileFromPath
  36.  
  37. -- remove file name from path name
  38. function pathName path
  39. get path
  40. if it is not empty then
  41.   put length(it) into m
  42.   repeat with i = m down to 1
  43.     if char i of it is ":" then exit repeat
  44.     delete char i of it
  45.   end repeat
  46. end if
  47. return it
  48. end pathName
  49.  
  50.  
  51. -- part 1 (field)
  52. -- low flags: 01
  53. -- high flags: 2004
  54. -- rect: left=25 top=85 right=109 bottom=491
  55. -- title width / last selected line: 0
  56. -- icon id / first selected line: 0 / 0
  57. -- text alignment: 0
  58. -- font id: 3
  59. -- text size: 12
  60. -- style flags: 0
  61. -- line height: 16
  62. -- part name: stack path
  63. ----- HyperTalk script -----
  64. on mouseUp
  65.   put fileName("STAK") into me
  66. end mouseUp
  67.  
  68.  
  69. -- part 2 (field)
  70. -- low flags: 00
  71. -- high flags: 2007
  72. -- rect: left=339 top=152 right=329 bottom=489
  73. -- title width / last selected line: 0
  74. -- icon id / first selected line: 0 / 0
  75. -- text alignment: 0
  76. -- font id: 3
  77. -- text size: 12
  78. -- style flags: 0
  79. -- line height: 16
  80. -- part name: bad cards
  81.  
  82.  
  83. -- part 3 (field)
  84. -- low flags: 01
  85. -- high flags: 2002
  86. -- rect: left=25 top=152 right=174 bottom=132
  87. -- title width / last selected line: 0
  88. -- icon id / first selected line: 0 / 0
  89. -- text alignment: 0
  90. -- font id: 3
  91. -- text size: 12
  92. -- style flags: 0
  93. -- line height: 16
  94. -- part name: current card
  95.  
  96.  
  97. -- part 4 (button)
  98. -- low flags: 00
  99. -- high flags: A004
  100. -- rect: left=25 top=217 right=243 bottom=100
  101. -- title width / last selected line: 0
  102. -- icon id / first selected line: 0 / 0
  103. -- text alignment: 1
  104. -- font id: 0
  105. -- text size: 12
  106. -- style flags: 0
  107. -- line height: 16
  108. -- part name: Recover
  109. ----- HyperTalk script -----
  110. on mouseUp
  111.   global path, stackName
  112.   put card field "stack path" into path
  113.   put fileFromPath(path) into stackName
  114.   if path is empty or stackName is empty then
  115.     answer "Specify stack to recover first." with "OK"
  116.     exit mouseUp
  117.   end if
  118.   recover
  119. end mouseUp
  120.  
  121. -- fixed problem with substring hits  11/17/89 mj
  122.  
  123. on recover
  124.   global path, stackName
  125.   global myName, theCard
  126.   put the short name of this stack into myName
  127.   put the short id of this card into theCard
  128.   set lockMessages to true
  129.   put true into getStackScript
  130.   put return & card field "bad cards" & return into broken
  131.   put (card field "current card") + 1 into j
  132.   put 0 into n
  133.   put "Recovering ‚Äú" & stackName & "‚Äù"
  134.   repeat with i = j to 16777216 -- max cards/stack
  135.     if (return & i & return) is not in broken then
  136.       put i into card field "current card"
  137.       lock screen
  138.       go to card i of stack stackName
  139.       if the result is empty then
  140.         if getStackScript then
  141.           put script of this stack into theScript
  142.         end if
  143.         doMenu "Copy Card"
  144.         go to last card of stack myName
  145.         doMenu "Paste Card"
  146.         add 1 to n
  147.         go card id theCard of stack myName
  148.         if getStackScript then
  149.           set script of this stack to theScript
  150.           put false into getStackScript
  151.         end if
  152.       else
  153.         go card id theCard of stack myName
  154.         put empty into card field "current card"
  155.         exit repeat
  156.       end if
  157.       unlock screen
  158.     end if
  159.   end repeat
  160.   put "Compacting‚Ķ"
  161.   doMenu "Compact Stack"
  162.   openCard
  163.   put n && "cards recovered."
  164.   set cursor to arrow
  165. end recover
  166.  
  167.  
  168. -- part 5 (button)
  169. -- low flags: 00
  170. -- high flags: A004
  171. -- rect: left=170 top=152 right=175 bottom=287
  172. -- title width / last selected line: 0
  173. -- icon id / first selected line: 0 / 0
  174. -- text alignment: 1
  175. -- font id: 0
  176. -- text size: 12
  177. -- style flags: 0
  178. -- line height: 16
  179. -- part name: >> Copy >>
  180. ----- HyperTalk script -----
  181. on mouseUp
  182.   get card field "current card"
  183.   if it is not empty then
  184.     if (it & return) is not in card field "bad cards" then
  185.       put it & return after card field "bad cards"
  186.     end if
  187.   end if
  188. end mouseUp
  189.  
  190.  
  191.  
  192. -- part 6 (button)
  193. -- low flags: 00
  194. -- high flags: A004
  195. -- rect: left=25 top=185 right=211 bottom=100
  196. -- title width / last selected line: 0
  197. -- icon id / first selected line: 0 / 0
  198. -- text alignment: 1
  199. -- font id: 0
  200. -- text size: 12
  201. -- style flags: 0
  202. -- line height: 16
  203. -- part name: Clear
  204. ----- HyperTalk script -----
  205. on mouseUp
  206.   answer "Really clear everything?" with "Yes" or "No"
  207.   if it is "Yes" then
  208.     put empty into card field "bad cards"
  209.     put empty into card field "current card"
  210.     set cursor to busy
  211.     set lockMessages to true
  212.     lock screen
  213.     put the id of this card into saveMe
  214.     put number of cards into m
  215.     repeat with i = m down to 1
  216.       go to card i
  217.       if (the id of this card) ‚↠saveMe then
  218.         set cantDelete of this card to false
  219.         doMenu "Delete Card"
  220.       end if
  221.     end repeat
  222.     set script of this stack to empty
  223.     put "Compacting‚Ķ"
  224.     doMenu "Compact Stack"
  225.     put empty
  226.     openCard
  227.     set cursor to arrow
  228.   end if
  229. end mouseUp
  230.  
  231.  
  232.  
  233. -- part 7 (button)
  234. -- low flags: 00
  235. -- high flags: 2000
  236. -- rect: left=3 top=309 right=339 bottom=42
  237. -- title width / last selected line: 0
  238. -- icon id / first selected line: 21700 / 21700
  239. -- text alignment: 1
  240. -- font id: 0
  241. -- text size: 12
  242. -- style flags: 0
  243. -- line height: 16
  244. -- part name: Home
  245. ----- HyperTalk script -----
  246. on mouseUp
  247.   go Home
  248. end mouseUp
  249.  
  250.  
  251.  
  252. -- part 8 (button)
  253. -- low flags: 80
  254. -- high flags: 2000
  255. -- rect: left=179 top=315 right=339 bottom=210
  256. -- title width / last selected line: 0
  257. -- icon id / first selected line: 1014 / 1014
  258. -- text alignment: 1
  259. -- font id: 0
  260. -- text size: 12
  261. -- style flags: 0
  262. -- line height: 16
  263. -- part name: Prev
  264. ----- HyperTalk script -----
  265. on mouseUp
  266.   go prev card
  267. end mouseUp
  268.  
  269.  
  270.  
  271. -- part 9 (button)
  272. -- low flags: 80
  273. -- high flags: 2000
  274. -- rect: left=213 top=315 right=339 bottom=244
  275. -- title width / last selected line: 0
  276. -- icon id / first selected line: 1013 / 1013
  277. -- text alignment: 1
  278. -- font id: 0
  279. -- text size: 12
  280. -- style flags: 0
  281. -- line height: 16
  282. -- part name: Next
  283. ----- HyperTalk script -----
  284. on mouseUp
  285.   go next card
  286. end mouseUp
  287.  
  288.  
  289.  
  290. -- part 10 (button)
  291. -- low flags: 00
  292. -- high flags: 2000
  293. -- rect: left=463 top=10 right=39 bottom=503
  294. -- title width / last selected line: 0
  295. -- icon id / first selected line: 19678 / 19678
  296. -- text alignment: 1
  297. -- font id: 0
  298. -- text size: 12
  299. -- style flags: 0
  300. -- line height: 16
  301. -- part name: Info
  302. ----- HyperTalk script -----
  303. on mouseDown
  304.   show card field "Info"
  305.   repeat while the mouse is down
  306.   end repeat
  307.   hide card field "Info"
  308. end mouseDown
  309.  
  310.  
  311.  
  312. -- part 11 (field)
  313. -- low flags: 81
  314. -- high flags: 2004
  315. -- rect: left=344 top=2 right=90 bottom=510
  316. -- title width / last selected line: 0
  317. -- icon id / first selected line: 0 / 0
  318. -- text alignment: 0
  319. -- font id: 2
  320. -- text size: 12
  321. -- style flags: 0
  322. -- line height: 16
  323. -- part name: Info
  324. ----- HyperTalk script -----
  325. on mouseUp
  326.   hide me
  327. end mouseUp
  328.  
  329.  
  330. -- part 12 (field)
  331. -- low flags: 01
  332. -- high flags: 0007
  333. -- rect: left=116 top=185 right=303 bottom=330
  334. -- title width / last selected line: 0
  335. -- icon id / first selected line: 0 / 0
  336. -- text alignment: 0
  337. -- font id: 3
  338. -- text size: 10
  339. -- style flags: 0
  340. -- line height: 13
  341. -- part name: Help
  342.  
  343.  
  344. -- part contents for card part 11
  345. ----- text -----
  346. by Greg Jorgensen
  347. Macintosh Developer Technical Support
  348. ¬© 1989
  349. Apple Computer, Inc.
  350.  
  351. -- part contents for card part 12
  352. ----- text -----
  353. How to use Recover Stack
  354. ----------------------------
  355. Recover Stack attempts to recover broken Hypercard stacks by copying all of the good cards out of the corrupted stack, ignoring the broken ones. Everything needed to run Recover Stack is on this card, except for the FileName XFCN, which is in the stack.
  356.  
  357. Recover Stack puts all of the good cards from the corrupted stack after itself in this stack. To use, make a copy of this stack, rename it, and start it up.
  358.  
  359. Select the corrupted stack to recover by clicking on the field under ‚ÄúName of stack to recover‚Äù above. If you know the numbers (not IDs) of the bad cards in the corrupted stack, type them in, one per line, in the field ‚ÄúBad card numbers‚Äù to the right.
  360.  
  361. Click on ‚ÄúRecover‚Äù to begin. If a bad card that is not in the bad card list is encountered, Hypercard will abort. Just restart this stack, use the ‚ÄúCopy‚Äù button above to add the broken card to the list, and click on ‚ÄúRecover‚Äù to proceed.
  362.  
  363. You can clear everything by clicking on ‚ÄúClear.‚Äù  It will clear the bad card list and delete any recovered cards in this stack, leaving only this card.
  364.  
  365. When all good cards have been recovered, you can delete this card from the stack (You‚Äôll have to change its ‚ÄúCantDelete‚Äù property first ‚Äî pull down ‚ÄúCard Info‚Äù from the ‚ÄúObjects‚Äù menu).  You will then have a stack containing all of the recovered cards. Backgrounds are preserved, and the stack script from the corrupted stack will be in this stack‚Äôs script.
  366.  
  367. Recover Stack won‚Äôt be able to recover all corrupted stacks ‚Äî it is possible for a stack to be corrupted in such a way that it can‚Äôt be opened at all. Recover Stack will be able to recover from the most common kinds of corruption, with a minimum loss of cards.
  368.